package com.example.demo.config;

import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;

import com.example.demo.shiro.ShiroSimpleTag;
 

@Configuration
public class StaticResourceConfig {

	@Bean
	public FreeMarkerConfigurer freeMarkerConfigurer(ShiroSimpleTag shiroTag) {
		FreeMarkerConfigurer configurer=new FreeMarkerConfigurer();
		configurer.setTemplateLoaderPath("classpath:/views");
		
		Map<String, Object> variables=new HashMap<String, Object>();
		variables.put("shiro", shiroTag);
		configurer.setFreemarkerVariables(variables);
		
		Properties settings=new Properties();
		settings.setProperty("default_encoding", "utf-8");
//		settings.setProperty("number_formart", "0.###");
		configurer.setFreemarkerSettings(settings);
		
		return configurer;
	}
	
}
